import request from '../utils/request'
import Qs from 'qs'

export default {
  getAll: function (current, size, searchText) {
    const data = {
      current,
      size
    }
    if (searchText) {
      data.keywords = searchText
    }
    return request.get(
      '/api/comments?' + Qs.stringify(data),
      { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }
    )
  },
  edit (id) {
    return request.put('/api/comments/' + id)
  },
  remove (id) {
    return request.delete('/api/comments/' + id)
  }
}
